#ifndef _HHY_CLOCK_315MHZ_H_
#define _HHY_CLOCK_315MHZ_H_

#include "HT66F0185.h"
#include "Timer.h"

#define LX1528 //遥控器编码IC

#define HHY_PASSWORD 0B01010001000100001010 //20位
#define HHY_DATAWIDTH 1392 //us defaul:1.392ms=1392  整除4
#define LOCK_START_AGAIN_TIME 600

#define TX_315MHZ_IO_L() { _pd0 = 0; _pb0 = 0;}
#define TX_315MHZ_IO_H() { _pd0 = 1; _pb0 = 1;}
#define TX_315MHZ_LED_IO_L() { _pb0 = 0;}
#define TX_315MHZ_LED_IO_H() { _pb0 = 1;}
#define TX_315MHZ_LED_IO_TURN() { _pb0 = ~_pb0;}
typedef enum
{
    KEY_NONE     , //NONE
    KEY_UNLOCK   , //解锁
    KEY_STARTUP  , //启动
    KEY_STARTUP_Again ,
    KEY_LOCK     , //锁车
} KEYState_t;
typedef struct
{
	
    unsigned long PassWord;	//内码
    unsigned char Data;     //按键码
    unsigned char KeyValue; //按键值
    unsigned int StartTime_Cnt; //
    unsigned int LEDTurn_TimeCnt; //LED閃爍
	union {
		struct
		{
			unsigned char IsReady : 1;
		} b;
		unsigned char byte;
	} flag;
} HHYLock_t;
extern volatile HHYLock_t HHYLock;


void fun_HHYLock_Key_Tx(); //IO数据输出
void fun_HHYClock_Init();
void fun_HHYClock_LED();


#endif

